class Solution {
public:
    int findMinArrowShots(vector<vector<int>>& points) {
        sort(points.begin(), points.end());
        int ret = 1;
        int right = points[0][1];
        for (int i = 1; i < points.size(); i++)
        {
            int a = points[i][0], b = points[i][1];
            if (a <= right)
            {
                right = min(right, b);
            }
            else
            {
                right = b;
                ret++;
            }
        }
        return ret;
    }
};